home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2003 July / CD 1 / APC0307D1.iso / fwv / xmlspy / files / XMLSPYEntComplete5.exe / Data1.cab / _A4961DB1CCCA4719BD41A8C1CBAE6D54 < prev    next >
Encoding:
Text File  |  2002-10-21  |  6.4 KB  |  212 lines

  1. <!-- 
  2. TEI XSLT stylesheet family version 1.2
  3. RCS: $Date: 2002/10/21 13:44:24 $, $Revision: 1.1.2.1 $, $Author: jdj $
  4.  
  5. XSL stylesheet to format TEI XML documents to HTML or XSL FO
  6.  
  7.  Copyright 1999-2002 Sebastian Rahtz/Oxford University  <sebastian.rahtz@oucs.ox.ac.uk>
  8.  
  9.  Permission is hereby granted, free of charge, to any person obtaining
  10.  a copy of this software and any associated documentation files (the
  11.  ``Software''), to deal in the Software without restriction, including
  12.  without limitation the rights to use, copy, modify, merge, publish,
  13.  distribute, sublicense, and/or sell copies of the Software, and to
  14.  permit persons to whom the Software is furnished to do so, subject to
  15.  the following conditions:
  16.  
  17.  The above copyright notice and this permission notice shall be included
  18.  in all copies or substantial portions of the Software.
  19. --> 
  20. <xsl:stylesheet
  21.   xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  22.   version="1.0">
  23.  
  24.  
  25. <xsl:template name="noteID">
  26.   <xsl:choose>
  27.    <xsl:when test="@id">
  28.     <xsl:value-of select="@id"/>
  29.    </xsl:when>
  30.    <xsl:when test="@n">
  31.     <xsl:value-of select="@n"/>
  32.    </xsl:when>
  33.    <xsl:when test="ancestor::back">
  34.     <xsl:number level="any"  count="note[@place='foot']" from="back"/>
  35.    </xsl:when>
  36.    <xsl:otherwise>
  37.     <xsl:number level="any" count="note[@place='foot']" from="body"/>
  38.    </xsl:otherwise>
  39.    </xsl:choose>
  40. </xsl:template>
  41.  
  42. <xsl:template match="note">
  43.  
  44. <xsl:choose>
  45.  
  46.  <xsl:when test="ancestor::bibl">
  47.   (<xsl:apply-templates/>)
  48.  </xsl:when>
  49.  
  50.  <xsl:when test="@place='inline'">
  51.    <xsl:text> (</xsl:text>
  52.     <xsl:apply-templates/>
  53.    <xsl:text>)</xsl:text>
  54.  </xsl:when>
  55.  
  56.  <xsl:when test="@place='display'">
  57.    <blockquote>NOTE:
  58.     <xsl:apply-templates/>
  59.    </blockquote>
  60.  </xsl:when>
  61.  
  62.  
  63.  <xsl:when test="@place='foot'">
  64.   <xsl:variable name="identifier">
  65.     <xsl:call-template name="noteID"/>
  66.   </xsl:variable>
  67.   <xsl:choose>
  68.    <xsl:when test="$footnoteFile">
  69.     <a class="notelink" href="{$masterFile}-notes.html#{concat('Note',$identifier)}">
  70.     <sup><xsl:value-of select="$identifier"/></sup></a>
  71.    </xsl:when>
  72.    <xsl:otherwise>
  73.     <a class="notelink" href="#{concat('Note',$identifier)}">
  74.     <sup><xsl:value-of select="$identifier"/></sup></a>
  75.    </xsl:otherwise>
  76.   </xsl:choose>
  77.  </xsl:when>
  78.  
  79.  <xsl:otherwise>
  80.    <xsl:text> [Note: </xsl:text>
  81.     <xsl:apply-templates select="." mode="printnotes"/>
  82.    <xsl:text>]</xsl:text>
  83.  </xsl:otherwise>
  84. </xsl:choose>
  85. </xsl:template>
  86.  
  87.  
  88. <!--div|div0|div1|div2|div3|div4|div5|div6-->
  89.  
  90. <xsl:template name="printNotes">
  91. <xsl:choose>
  92. <xsl:when test="$footnoteFile">
  93. <xsl:variable name="BaseFile">
  94.   <xsl:value-of select="$masterFile"/>
  95.   <xsl:if test="ancestor::teiCorpus.2">
  96.     <xsl:text>-</xsl:text>
  97.      <xsl:choose>
  98.       <xsl:when test="@id"><xsl:value-of select="@id"/></xsl:when> 
  99.       <xsl:otherwise><xsl:number/></xsl:otherwise>
  100.      </xsl:choose>
  101.   </xsl:if>
  102. </xsl:variable>
  103.  
  104.   <xsl:call-template name="outputChunk">
  105.   <xsl:with-param name="ident">
  106.     <xsl:value-of select="concat($BaseFile,'-notes')"/>
  107.   </xsl:with-param>
  108.   <xsl:with-param name="content">
  109.     <xsl:call-template name="writeNotes"/>
  110.   </xsl:with-param>
  111.   </xsl:call-template>
  112. </xsl:when>
  113.  
  114. <xsl:otherwise>
  115.   <xsl:apply-templates select="text//note[@place='foot']" mode="printnotes"/>
  116. </xsl:otherwise>
  117.  
  118. </xsl:choose>
  119. </xsl:template>
  120.  
  121. <xsl:template name="printDivnotes">
  122.  <xsl:variable name="ident">
  123.    <xsl:apply-templates select="." mode="ident"/>
  124.  </xsl:variable>
  125.  <xsl:apply-templates select=".//note[@place='foot']" mode="printnotes">
  126.     <xsl:with-param name="root" select="$ident"/>
  127.   </xsl:apply-templates>
  128. </xsl:template>
  129.  
  130. <xsl:template match="note" mode="printnotes">
  131.  <xsl:param name="root"/>
  132. <xsl:if test="not(ancestor::bibl)">
  133. <xsl:variable name="identifier">
  134. <xsl:choose>
  135.   <xsl:when test="@id">
  136.     <xsl:value-of select="@id"/>
  137.   </xsl:when>
  138.   <xsl:when test="@n">
  139.     <xsl:value-of select="@n"/>
  140.   </xsl:when>
  141.   <xsl:when test="ancestor::back">
  142.     <xsl:number level="any"  count="note[@place='foot']" from="back"/>
  143.   </xsl:when>
  144.   <xsl:when test="ancestor::front">
  145.     <xsl:number level="any"  count="note[@place='foot']" from="front"/>
  146.   </xsl:when>
  147.   <xsl:otherwise>
  148.     <xsl:number level="any" count="note[@place='foot']"  from="body"/>
  149.   </xsl:otherwise>
  150. </xsl:choose>
  151. </xsl:variable>
  152.  <xsl:variable name="parent">
  153.       <xsl:call-template name="locateParentdiv"/>
  154.  </xsl:variable>
  155. <xsl:if test="$parent=$root or $parent = '' or $footnoteFile">
  156.  <xsl:if test="$verbose">
  157.  <xsl:message>Note <xsl:value-of select="$identifier"/> with parent <xsl:value-of select="$parent"/> requested in <xsl:value-of select="$root"/></xsl:message>
  158.  </xsl:if>
  159. <p>
  160.  <a name="{concat('Note',$identifier)}"><xsl:value-of select="$identifier"/>. </a>
  161.  <xsl:apply-templates/>
  162. </p>
  163. </xsl:if>
  164. </xsl:if>
  165. </xsl:template>
  166.  
  167.  
  168. <xsl:template name="writeNotes">
  169.  <html><xsl:call-template name="addLangAtt"/> 
  170.  <head>
  171.  <title>Notes for
  172.     <xsl:apply-templates select="descendant-or-self::text/front//docTitle//text()"/></title>
  173.  <xsl:if test="not($cssFile = '')">
  174.    <link rel="stylesheet" type="text/css" href="{$cssFile}"/>
  175.  </xsl:if>
  176.  </head>
  177.  <body>
  178.  <xsl:call-template name="bodyHook"/>
  179.  <xsl:call-template name="bodyJavaScript"/>
  180.  <xsl:call-template name="stdheader">
  181.   <xsl:with-param name="title">
  182.    <xsl:text>Notes for </xsl:text>
  183.     <xsl:apply-templates select="descendant-or-self::text/front//docTitle//text()"/>
  184.   </xsl:with-param>
  185.  </xsl:call-template>
  186.  
  187.  <xsl:call-template name="processFootnotes"/>
  188.  
  189.  <xsl:call-template name="stdfooter">
  190.        <xsl:with-param name="date">
  191.          <xsl:choose>
  192.           <xsl:when test="ancestor-or-self::TEI.2/teiHeader/revisionDesc//date[1]">
  193.             <xsl:value-of select="ancestor-or-self::TEI.2/teiHeader/revisionDesc//date[1]"/>
  194.           </xsl:when>
  195.           <xsl:otherwise>
  196.            <xsl:value-of select="ancestor-or-self::TEI.2//front//docDate"/>
  197.           </xsl:otherwise>    
  198.          </xsl:choose>
  199.        </xsl:with-param>
  200.        <xsl:with-param name="author">
  201.          <xsl:apply-templates select="ancestor-or-self::TEI.2//front//docAuthor" mode="author"/>
  202.        </xsl:with-param>
  203.  </xsl:call-template>
  204.  </body>
  205.  </html>
  206. </xsl:template>
  207.  
  208. <xsl:template name="processFootnotes">
  209.   apply-templates select="text//note[@place='foot']" mode="printnotes"/>
  210. </xsl:template>
  211. </xsl:stylesheet>
  212.